package com.czkj.hwz.decorate.Activity;

import android.os.Build;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;

import com.czkj.hwz.decorate.R;
import com.czkj.hwz.decorate.bean.Goods;
import com.czkj.hwz.decorate.bean.Rows;
import com.king.base.BaseActivity;

import net.tsz.afinal.FinalBitmap;

import java.util.ArrayList;
import java.util.List;

/**
 * 监理详情
 * @author lxm
 * created at 2017/10/24 10:53
 */
public class SupervisorDetailActivity extends BaseActivity {
    private static final String TAG = "SupervisorDetailActivit";
    private ImageView iv;
    private FinalBitmap fb;
    private List<Rows> rowsList;
    private Rows rows;
    private TextView name;
    @Override
    public void initUI() {
        if (Build.VERSION.SDK_INT >= 21){
            Window window = getWindow();
            //取消设置透明状态栏,使 ContentView 内容不再覆盖状态栏
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            //需要设置这个 flag 才能调用 setStatusBarColor 来设置状态栏颜色
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            //设置状态栏颜色
            window.setStatusBarColor(getResources().getColor(R.color.yellow));
        }
        setContentView(R.layout.activity_supervisor_detail);
        getSupportActionBar().hide();
        iv=findView(R.id.iv);
        name=findView(R.id.name);
        rowsList= (ArrayList<Rows>) getIntent().getSerializableExtra("rowsList");
        int position=getIntent().getIntExtra("position",0);
        Log.d(TAG, "initUI: "+rowsList.toString());
        Log.d(TAG, "initUI: "+position);
        Log.d(TAG, "initUI: "+rowsList.get(position).getQualificationList().toString());
        Log.d(TAG, "initUI: "+rowsList.get(position).getHonourList().toString());
        rows=rowsList.get(position);
        if (fb==null) {
            fb=FinalBitmap.create(context);
            fb.configBitmapMaxHeight(150);
            fb.configBitmapMaxWidth(150);
        }
    }

    @Override
    public void initData() {
        fb.display(iv,rows.getUser().getHeadimg());
        name.setText(rows.getName());
    }

    @Override
    public void addListeners() {

    }
    public void OnClick(View v) {
        switch (v.getId()) {
            case R.id.iv_back:
                finish();
                break;
        }
    }
}
